3-Computer Science-Software-Programming-Techniques

code access

Use all function arguments. Be able to access all code {code access}.

code comments

Add comments {code comments} for logical units. Add comments for modifications. Add inline comment after final brace to identify original brace.

conditional statement in software

Use IF-THEN-ELSE {conditional statement, software}, rather than multiple IFs. Use compound IFs, rather than nested IFs. Use braces for nested IF blocks. Always use ELSE after ELSE IF. Enter NULL statement ";" in IF block with no action. Use Switch statements, rather than IF-THEN-ELSE, if possible. Use default Switch at end, containing at least break statement.

constant in software

Use symbolic constants {constant, software}, with no hard-coded numbers.

data type in software

Do not use mixed data types {data type} in expressions. Do not use machine-dependent data representations.

dynamic memory

Use dynamic memory {dynamic memory, computer}, rather than allocating fixed storage. Verify that memory gave information. Free all memory structures no longer used. Allocate memory to structures to keep before structures to free, to avoid memory leaks.

error message in software

Use parameters for error messages {error message} and error numbers, not many hard-coded messages.

file header

Put file name, author, creation date, description, purpose, and modification history in file header {file header, information}.

function header

Put function name, author, creation date, short description, usage, possible return codes, and modification history in function header {function header}.

function return

Return success or failure status {function return} {return, function} to caller. Check status in caller. Store function-return codes in caller for future reference. Do not test function logical value directly. Declare return "void" for functions that do not return value. Declare argument list "void" for functions that do not use parameters.

GOTO command

Do not use GOTO statements {GOTO command}.

header file

Put definitions, global-variable declarations, and function prototypes in header files {header file}. Use "include" statements. For static functions used by one module, put prototype at module top.

input in software

Check input values {input, software} for range and reasonableness.

looping in software

Do not reinitialize index variables in loops {looping, software}. Do not use non-loop-dependent statements in loop bodies.

module files

Put modules in separate files {module files}. Put source code for C++ classes in .CXX files. Put class definitions in .HXX files. Use only logically related functions. Use one entry and exit point for each function. Exit program only through "main" command.

object names in software

Make object names {object names, software} descriptive and globally unique. Use suffix for object types, like libraries. For functions, use lowercase or mixed case. For variables, use lowercase or mixed case. For constants, use uppercase.

operating system services

Minimize operating-system services {operating system services}. Put operating-system services in "system" library, not in high-level code.

readability in software

Separate variables and operators {readability, software}. Write one statement per line, using consistent indentation for logical structure. Place lead brace on same line as statement, or place on next line in same column as statement beginning. Put end brace in same column as statement beginning. Indicate conditional statement using inline comment after end brace.

standard usage in software

Use only standard programming language {standard usage, software}.

variable declaration

Use one line for each variable declaration {variable declaration}. Minimize number of global variables and external variables by passing arguments by value or reference. Declare arrays and do not use pointers except for dynamically allocated memory. Use structures for related data elements, to treat them as single objects.

WHILE command

Do not exit from WHILE-statement body {WHILE command}.

3-Computer Science-Software-Programming-Techniques-Objects

encapsulation

Only methods can access objects {encapsulation, programming}.

inheritance

You can make a child class with all the members and methods of a parent class, and then add extra members and methods {inheritance, programming}.

polymorphism programming

If classes share common methods, the same methods can apply to all the classes {polymorphism, programming}.

Liskov Substitution Principle

You can use a child-class instance if you can use a parent-class instance {Liskov Substitution Principle}.

Related Topics in Table of Contents

3-Computer Science-Software-Programming

Drawings

Drawings

Contents and Indexes of Topics, Names, and Works

Outline of Knowledge Database Home Page

Contents

Glossary

Topic Index

Name Index

Works Index

Searching

Search Form

Database Information, Disclaimer, Privacy Statement, and Rights

Description of Outline of Knowledge Database

Notation

Disclaimer

Copyright Not Claimed

Privacy Statement

References and Bibliography

Consciousness Bibliography

Technical Information

Date Modified: 2022.0225